package com.walle.ak47.commons.vcloud163;

import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.walle.ak47.commons.utils.HttpClientUtils;

public class Test {

	public static void main(String[] args) throws IOException {
		
		String url = "https://vcloud.163.com/app/channel/create";
        String appKey = "4f04f79d83bc42de845e32e5578e63d2";
        String appSecret = "1386896fc58f4940bee3b222bae4582b";
        String nonce =  "1";
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
		
        Map<String, String> _headers = new HashMap<String,String>() ;
        _headers.put( "AppKey", appKey) ;
        _headers.put( "Nonce", nonce) ;
        _headers.put( "CurTime", curTime) ;
        _headers.put( "CheckSum", checkSum) ;
        _headers.put( "CheckSum", checkSum) ;
        String _stringOrStream = "{\"name\":\"netease_vcloud\", \"type\":0}";
		System.err.println( HttpClientUtils.getResponseAsString( url, _stringOrStream, _headers, null, "application/json;charset=utf-8", 0) );
	}
}
